package com.trg.designmodel.builder.improve;

/**
 * @ClassName: HouseDirector
 * @Description: 建造房子的指挥者
 * @Author: tangrg
 * @Date: 2021/7/2 16:11
 * @Version: 1.0
 * @Return:
 **/
public class HouseDirector {
    HouseBuilder houseBuilder = null;

    //通过构造器的方式传入
    public HouseDirector(HouseBuilder houseBuilder) {
        this.houseBuilder = houseBuilder;
    }

    //通过 setter 传入 houseBuilder
    public void setHouseBuilder(HouseBuilder houseBuilder) {
        this.houseBuilder = houseBuilder;
    }

    public House constructHouse( ) {
        houseBuilder.buildBasic();
        houseBuilder.buildWalls();
        houseBuilder.roofed();
        return houseBuilder.build();
    }

}
